package com.sky.controller.admin;

import com.sky.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;


/**
 * 店铺操作接口
 */
@RequestMapping("/admin/shop")
@RestController
public class ShopController {
    @Autowired
    RedisTemplate redisTemplate;

    private static final String SHOP_STATUS = "SHOP_STATUS";

    /**
     * 获取营业状态
     * @return
     */
    @GetMapping("/status")
    public Result getStatus(){
        return Result.success(redisTemplate.opsForValue().get(SHOP_STATUS));
    }
    /**
     * 设置营业状态
     */
    @PutMapping("{status}")
    public Result setStatus(@PathVariable Integer status){
        redisTemplate.opsForValue().set(SHOP_STATUS,status);
        return Result.success();
    }

}
